package com.xuanxu.blogs.module.article.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.xuanxu.blogs.module.article.entity.dao.ArticleContentDao;
import com.xuanxu.blogs.module.article.entity.po.ArticleContent;
import com.xuanxu.blogs.module.article.mapper.ArticleContentMapper;
import com.xuanxu.blogs.module.article.service.ArticleContentService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @author XuanXu
 * @version 1.0
 * @date 2024-08-23 14:09
 */
@Service
@RequiredArgsConstructor
public class ArticleContentServiceImpl implements ArticleContentService {

    private final ArticleContentMapper articleContentMapper;

    @Override
    public ArticleContentDao selectArticleContentByArticleId(Long articleId) {
        if (articleId == null) {
            return null;
        }
        ArticleContent articleContent = articleContentMapper.selectById(articleId);
        return BeanUtil.copyProperties(articleContent, ArticleContentDao.class);
    }
}
